package es.ojugames.yincana;

import es.ojugames.yincana.creacion.CreatePuntoActivity;
import es.ojugames.yincana.creacion.CreateRouteActivity;
import es.ojugames.yincana.rutas.ComunidadesActivity;
import android.app.Activity;
import android.content.Intent;
import android.location.LocationManager;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;

public class MainActivity extends Activity {
	Button rutas, crearRutas, opciones;
	
	private LocationManager locManager;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        
        locManager = (LocationManager)getSystemService(LOCATION_SERVICE);
        
        setContentView(R.layout.main);
    }
    
    @Override
	public void onResume(){
		super.onResume();
		
		if(!locManager.isProviderEnabled(LocationManager.GPS_PROVIDER))
		{
			Intent intent = new Intent(MainActivity.this, CheckLocationServiceActivity.class);
	    	startActivity(intent);
		}
	}
    
    public void comunidades(View v) {
    	Intent intent = new Intent(MainActivity.this, ComunidadesActivity.class);
        startActivity(intent);
    }
    
    public void crearruta(View v){
    	Intent intent = new Intent(MainActivity.this, CreateRouteActivity.class);
    	startActivity(intent);
    }
    
    public void goToNoDisponible(View v){
    	Intent intent = new Intent(MainActivity.this, NoDisponibleActivity.class);
    	startActivity(intent);
    }
}